/*    */ package nc.bs.pub.action;
/*    */ 
/*    */ import nc.bs.ecn.ecr.plugin.EcrPluginPoint;
/*    */ import nc.bs.ecn.ecr.rule.EcrBillStatusApproveCheckRule;
/*    */ import nc.bs.ecn.ecr.rule.EcrBillStatusGoingonCheckRule;
/*    */ import nc.bs.ecn.ecr.rule.EcrChangeVOStatus2UpdateRule;
import nc.bs.ecn.ecr.rule.RewriteMsgRule;
/*    */ import nc.bs.framework.common.NCLocator;
/*    */ import nc.bs.pubapp.pf.action.AbstractPfAction;
/*    */ import nc.impl.pubapp.pattern.rule.ICompareRule;
/*    */ import nc.impl.pubapp.pattern.rule.IRule;
/*    */ import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
/*    */ import nc.itf.ecn.ecr.IEcrMaintain;
/*    */ import nc.vo.ecn.ecr.entity.AggEcrVO;
/*    */ import nc.vo.pub.BusinessException;
/*    */ import nc.vo.pubapp.pattern.exception.ExceptionUtils;
/*    */ import nc.vo.pubapp.pattern.model.entity.bill.IBill;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class N_19A2_APPROVE
/*    */   extends AbstractPfAction<AggEcrVO>
/*    */ {
/* 34 */   public IEcrMaintain getUpdateService() { return (IEcrMaintain)NCLocator.getInstance().lookup(IEcrMaintain.class); }
/*    */ 
/*    */ 
/*    */   
/*    */   protected CompareAroundProcesser<AggEcrVO> getCompareAroundProcesserWithRules(Object userObj) {
/* 39 */     CompareAroundProcesser<AggEcrVO> processer = new CompareAroundProcesser<AggEcrVO>(EcrPluginPoint.APPROVE);
/*    */     
/* 41 */     addBeforeRule(processer);
/*    */     
/* 43 */     addAfterRule(processer);
/*    */     
/* 45 */     return processer;
/*    */   }
/*    */ 
/*    */   
/*    */   protected AggEcrVO[] processBP(Object userObj, AggEcrVO[] clientFullVOs, AggEcrVO[] originBills) {
/* 50 */     AggEcrVO[] returnbill = null;
/*    */     try {
/* 52 */       returnbill = getUpdateService().auditEcr(clientFullVOs, originBills);
/*    */     }
/* 54 */     catch (BusinessException e) {
/* 55 */       ExceptionUtils.wrappException(e);
/*    */     } 
/* 57 */     return returnbill;
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   private void addBeforeRule(CompareAroundProcesser<AggEcrVO> processer) {
/* 66 */     IRule<AggEcrVO> approveStatusCheckRule = new EcrBillStatusApproveCheckRule();
/* 67 */     processer.addBeforeRule(approveStatusCheckRule);
/*    */     
/* 69 */     ICompareRule<AggEcrVO> statusChkRule = new EcrBillStatusGoingonCheckRule();
/* 70 */     processer.addBeforeRule(statusChkRule);
/*    */ 
/*    */ 
/*    */     
/* 74 */     IRule<AggEcrVO> voStatusRule = new EcrChangeVOStatus2UpdateRule();
/* 75 */     processer.addBeforeRule(voStatusRule);
/*    */   }
/*    */   
/*    */   private void addAfterRule(CompareAroundProcesser<AggEcrVO> processer) {
	         processer.addAfterRule(new RewriteMsgRule());
           }           
/*    */ }


